home *** CD-ROM | disk | FTP | other *** search
/ One Click 11 / OneClick11.iso / Bancos de Dados / Conversao / Mysql2Excel / Setup.exe / Mysql2Excel.exe / win32com / client / CLSIDToClass.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2003-06-23  |  2.6 KB  |  67 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.2)
  3.  
  4. '''Manages a dictionary of CLSID strings to Python classes.
  5.  
  6. Primary use of this module is to allow modules generated by
  7. makepy.py to share classes.  @makepy@ automatically generates code
  8. which interacts with this module.  You should never need to reference
  9. this module directly.
  10.  
  11. This module only provides support for modules which have been previously
  12. been imported.  The gencache module provides some support for loading modules
  13. on demand - once done, this module supports it...
  14.  
  15. As an example, the MSACCESS.TLB type library makes reference to the
  16. CLSID of the Database object, as defined in DAO3032.DLL.  This
  17. allows code using the MSAccess wrapper to natively use Databases.
  18.  
  19. This obviously applies to all cooperating objects, not just DAO and
  20. Access.
  21. '''
  22. mapCLSIDToClass = { }
  23.  
  24. def RegisterCLSID(clsid, pythonClass):
  25.     '''Register a class that wraps a CLSID
  26. \t
  27. \tThis function allows a CLSID to be globally associated with a class.
  28. \tCertain module will automatically convert an IDispatch object to an
  29. \tinstance of the associated class.
  30. \t'''
  31.     mapCLSIDToClass[str(clsid)] = pythonClass
  32.  
  33.  
  34. def RegisterCLSIDsFromDict(dict):
  35.     """Register a dictionary of CLSID's and classes.
  36. \t
  37. \tThis module performs the same function as @RegisterCLSID@, but for
  38. \tan entire dictionary of associations.
  39. \t
  40. \tTypically called by makepy generated modules at import time.
  41. \t"""
  42.     
  43.     try:
  44.         mapCLSIDToClass.update(dict)
  45.     except AttributeError:
  46.         for clsid, pythonClass in dict.items():
  47.             mapCLSIDToClass[clsid] = pythonClass
  48.         
  49.  
  50.  
  51.  
  52. def GetClass(clsid):
  53.     '''Given a CLSID, return the globally associated class.
  54. \t
  55. \tclsid -- a string CLSID representation to check.
  56. \t'''
  57.     return mapCLSIDToClass[clsid]
  58.  
  59.  
  60. def HasClass(clsid):
  61.     '''Determines if the CLSID has an associated class.
  62. \t
  63. \tclsid -- the string CLSID to check
  64. \t'''
  65.     return mapCLSIDToClass.has_key(clsid)
  66.  
  67.